﻿@model BrnMall.Web.StoreAdmin.Models.AddProductModel
@{
    BrnMall.Web.StoreAdmin.Models.ProductImageListModel imgs = (BrnMall.Web.StoreAdmin.Models.ProductImageListModel)ViewData["image"];
}
@section header{
    <title>添加商品-商品管理</title>
    <link type="text/css" rel="stylesheet" href="~/admin_store/css/site.css" />
    <link type="text/css" rel="stylesheet" href="/admin_store/css/product.css" />
    <link type="text/css" rel="stylesheet" href="/components/umeditor/themes/default/css/umeditor.css">
    <link type="text/css" rel="stylesheet" href="/components/webuploader/webuploader.css" />
    <link type="text/css" rel="stylesheet" href="/components/jbox/Skins/Default/jbox.css" />
    <script type="text/javascript" src="/admin_store/scripts/jquery.js"></script>
    <script type="text/javascript" src="/components/umeditor/umeditor.config.js"></script>
    <script type="text/javascript" src="/components/umeditor/umeditor.js"></script>
    <script type="text/javascript" src="/components/umeditor/lang/zh-cn/zh-cn.js"></script>
    <script type="text/javascript" src="/admin_store/scripts/jquery.validate.js"></script>
    <script type="text/javascript" src="/admin_store/scripts/jquery.validate.unobtrusive.js"></script>
    <script type="text/javascript" src="/components/webuploader/webuploader.js"></script>
    <script type="text/javascript" src="/components/jbox/jquery.jBox-2.3.min.js"></script>
    <script type="text/javascript" src="/admin_store/scripts/selectlist.js"></script>
    <script type="text/javascript" src="~/admin_store/scripts/product_new.js"></script>
    <script type="text/javascript" src="/admin_store/scripts/showlist.js"></script>
    <script type="text/javascript" src="/components/my97datepicker/WdatePicker.js"></script>
    <script type="text/javascript" src="http://wxpassport.711688.net.cn/files/Scripts/v3/ajax-data.js"></script>
    <script type="text/javascript" src="http://wxpassport.711688.net.cn/files/localfiles/Scripts/jquery.form.min.js"></script>
    <script src="http://malsup.github.io/jquery.form.js"></script>

    <script type="text/javascript">
        productPageType=3;
        @{
            StringBuilder productAttributeListStr = new StringBuilder();
            if (Model.AttrIdList!=null && Model.AttrIdList.Length >0)
            {
                productAttributeListStr.Append("[");
                for (int i=0;i<Model.AttrIdList.Length;i++)
                {
                    productAttributeListStr.AppendFormat("{0}'attrId':'{1}','attrValueId':'{2}','inputValue':'{3}','attrPriceList':'{4}',{5},", "{", Model.AttrIdList[i], Model.AttrValueIdList[i], Model.AttrInputValueList[i],Model.AttrPriceList[i],"}");
                }

                productAttributeListStr.Remove(productAttributeListStr.Length - 1, 1);
                productAttributeListStr.Append("]");
            }
            else
            {
                productAttributeListStr.Append("null");
            }
         }
        //商品属性列表
        productAttributeList = @Html.Raw(productAttributeListStr.ToString());

    </script>
    <script type="text/javascript">
        var imgIndex=0;     //商品图片索引
        $(function () {
            //判断是否上架
            $('#chkState').click(function () {
                if(document.getElementById("chkState").checked)
                    $("#State").val("0");
                else
                    $("#State").val("1");
            });

            $(".submitAttr").click(function(){submitAttr()});
            $('#ZDSKU').click(function () {$('#SKUimg').css("display","block")});
            $('#btn1').click(function () {bindBtn1();});
            $('#btn2').click(function () {
                $('#one').css('display','block');
                $('#two').css('display','none');
                $('.addTag').children().eq(0).click()
            });
            $('#btn3').click(function () {
                bindBtn3();});
            $('#btn4').click(function () {
                $('#three').css('display','none');
                $('#two').css('display','block');
                $('.addTag').children().eq(1).click();
            });
            $('#btn5').click(function () {
                //判断是否有复制图片
                if($('.copylogo').val()!=null||$('.copylogo').val()!="")
                {
                    $('.nopic').css("diplay","none")
                }
                //判断处理
                if($('#SKUimg').attr('src')=="/admin_store/images/addproductimg/8.png"&&$('.skucolumn td').length>0){
                    var price=$('.price').val();
                    var Num=$('.nums').val();
                    var regu = /^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/;
                    var regu2=/^[1-9]\d*$/;
                    var lage=true;

                    $('.nums').each(function () {
                        if ($(this).val()== "") {
                            $.jBox.tip('库存不能为空！');
                            return lage=false ;
                        }else  if (!regu2.test(Num)) {
                            $.jBox.tip('库存只能为大于0的正整数！');
                            return lage=false ;
                        }
                    })
                    $('.price').each(function () {
                        if($(this).val()=="")
                        { $.jBox.tip( "本店价不能为空！");
                            return lage=false ;
                        }
                        else if(!regu.test(price))
                        { $.jBox.tip( "本店价为大于0的数字 ");
                            return lage=false ;
                        }
                        if(lage==true){
                            bindBtn5();
                        }
                    })




                }else{
                    bindBtn5();
                }
            });

            $('#btn6').click(function () {
                $('#four').css('display','none');
                $('#three').css('display','block');
                $('.addTag').children().eq(2).click()
            });  //返回第三步
            $('#btn7').click(function () {
                var addProduct='@Url.Action("AddProduct_new","product")';
                if($('#SKUimg').attr('src')=="/admin_store/images/addproductimg/7.png"){
                    $("#productform").attr("action",addProduct);
                }else{
                    addProduct='@Url.Action("AddSKU_New", "product")';
                    $("#productform").attr("action",addProduct);
                }
                $('.unselectedsortinput').removeAttr("focus");
                $('#Isone').val("0");
                bindBtn7();
                $.jBox.confirm("您确定要提交？", "提示！", function (v, h, f) {
                    if (v == "ok") {
                        if($('#txtID').val()!=null)
                        {
                            $("#txtID").removeAttr("onfocus");
                        }
                        $('#productform').submit();
                    }
                });
            }); //确定提交
            $('#btn8').click(function () {
                var addProduct2='@Url.Action("AddProduct_new","product")';
                if($('#SKUimg').attr('src')=="/admin_store/images/addproductimg/7.png"){
                    $("#productform").attr("action",addProduct2);
                }else{
                    addProduct2='@Url.Action("AddSKU_New", "product")';
                    $("#productform").attr("action",addProduct2);
                }
                $('#Isone').val("1");
                bindBtn7();
                $.jBox.confirm("您确定要提交？", "提示！", function (v, h, f) {
                    if (v == "ok") {
                        //$('#productform').submit();
                        $('#productform').ajaxSubmit({ url:addProduct2,
                            dataType: 'json',
                            cache: false,
                            error: function (data) {
                                $.jBox.tip(data);
                            },
                            success: function (data) {
                                if(data==jsonCode.success){
                                    $.jBox.tip('商品添加成功！');
                                    $('#one').css('display','block');
                                    $('#four').css('display','none');
                                    $('.addTag').children().eq(0).click();
                                }else{
                                    $.jBox.tip('商品添加失败！');
                                }

                            }
                        });
                    }
                });
            });  //确定提交并且再添加一条
            $('#btn9')
            $("#addImg").click(function () {
                if ($("#ShowImg").val() == "") {
                    $.jBox.tip('商品图片不能为空');
                    return false;
                }
            });
            bindUpload();
        });


        //增加sku新属性
        function addAttr(){
            showlayer();
        }

        //获取SKU属性组
        function getSkuColumn() {
            var arrColumn=[];
            $("#skuAttributeTable tr[name=attrTr]").each(function () {
                var isCheck = false;
                //是否选中属性
                $(this).find(".item").each(function () {
                    if ($(this).is(":checked"))
                        isCheck = true;
                });

                if (!isCheck) {
                    //是否填写自定义属性
                    $(this).find(".input").each(function () {
                        if ($(this).val() != '')
                            isCheck = true;
                    });
                }

                if (isCheck){
                    var name= $(this).find(".xs1").eq(0).attr("data-name");
                    arrColumn.push(name);
                }
            })
            return arrColumn;
        }

        //添加一张图片
        function addPic(data){
            var html=getPicHtml(data,imgIndex);
            $(".imglist").append(html);
            bindImgBtn();   //绑定列表的按钮实践
            imgIndex++;     //图片计数
            $(".nopic").css("display","none");
        }

        //商品图片行
        function getPicHtml(data,index){
            var html="";
            var ismain = index==0  ? "1":"0";
            var ismain_title= index==0 ? "是": "否";
            html+="<tr class='tr_"+index+"'>";
            html+="<td align='center'><input type='checkbox' value='0' /><input type='hidden' name='ismain' class='ismain ismain"+index+"' value='"+ismain+"' /><input type='hidden' name='isbanner' class='isbanner isbanner"+imgIndex+"' value='0' /></td>";
            html+="<td><img style='width:40px;height:40px;' src='@WorkContext.ImageCDN/upload/store/@WorkContext.StoreId/product/show/source/"+data+"' /></td>";
            html+="<td align='center'><span class='chkismain' data-index='"+index+"'>"+ismain_title+"</span></td>";
            html+="<td align='center'><span class='chkisbanner' data-isbanner='1' data-index='"+index+"'>是</span></td>";
            html+="<td align='center'><input type='text' name='ImgOrder' value='0' style='width:40px;' /></td>";
            html+="<td align='center'><span class='delPic' onclick='delpics(\""+parseInt(index+1)+"\")' data-index='"+index+"'>删除</span></td>";
            html+="</tr>";
            return html;
        }

        //添加新属性
        function submitAttr(){
            var param={AttributName:$('#attrValue').val(),AttrGroupId:99999999,ShowType:$('#ShowType').val(),IsFilter:$('#IsFilter').val()};
            //验证参数
            var cateId=document.getElementById("CateId").value;
            var catename=document.getElementById("backcatename").value;

            if(cateId<1){
                $.jBox.tip('请选择产品分类');
                return;
            }
            if(param.AttributName==''){
                $.jBox.tip('请填写属性名称');
                return;
            }

            //添加属性分组
            $.post('@Url.Action("addattribute", "Category")?cateId='+cateId,param,function(data){
                if(data !="success"){
                    $.jBox.error(data, '操作失败');
                    return;
                }
                closeBox();
                setSelectedCategory(cateId,catename);   //重新选择商品分类
                $("#attrValue").val("")
            });
        }

        //第三步提交校验
        function checkStep3(){
            var column=$(".skucolumn td");
            var allColumn=$(".xs1");

            if( $("#skuAttributeTable tr[name=attrTr]").length==0){
                return true;
            }else{
                if(allColumn==null || allColumn.length<1){
                    $.jBox.tip('没有SKU可以选择');
                    return true;
                }
                //验证SKU的价格、库存
                //if(column.length>3 && (column.length-3)>=allColumn.length){
                //}
                //else{
                //    $.jBox.tip('每组SKU至少选一个属性');
                //    return false;
                //}
                if(column.length<=3){
                    $.jBox.tip('至少选择一个属性');
                    return  false;
                }
                return true;
            }
        }


        //SKU和单个产品的切换
        function bechecked(){
            if($('#SKUimg').attr('src')=="/admin_store/images/addproductimg/7.png"){
                if( $("#skuAttributeTable tr[name=attrTr]").length==0){
                    $.jBox.tip('此分类没有SKU属性，可以自定义属性');
                }
                //禁用并且清空
                $('#myprice').attr('readonly','readonly').css('opacity','0.2');
                $('#myprice').val('0');
                $('#mynums').attr('readonly','readonly').css('opacity','0.2');
                $('#mynums').val('0');
                $('#SKUimg').attr('src','/admin_store/images/addproductimg/8.png');
                $('#myprice').css('disabled','disabled').css('readonly','readonly');
                $('#mynums').css('disabled','disabled').css('readonly','readonly');
                $('#Dj').css('opacity','1.0');
                $('#zhe').css('display','none');

            }
            else if($('#SKUimg').attr('src')=="/admin_store/images/addproductimg/8.png"){

                $('#myprice').css('opacity','1');
                $('#mynums').css('opacity','1');
                $('#mynums').removeAttr("readonly");
                $('#myprice').removeAttr("readonly");
                $('#SKUimg').attr('src','/admin_store/images/addproductimg/7.png')
                $('#Dj').css('opacity','0.5')
                $('#zhe').css('display','')

                //删除SKU组合
                $('.item').prop("checked", false);
                $(".skutable").html("");
            }
        };

        function bindBtn1(){
            //类型名称
            $('#carName').text($('#CategoryName').val());
            if ($('#StoreCid').val() == "-1") {
                $.jBox.tip('请选择店铺分类');
                return;
            }
            if ($('#StoreSTid').val() == "-1") {
                $.jBox.tip('请选择派送模板');
                return;
            }
            if($("#CateId").val()==''|| $("#CateId").val()=='-1'){
                $.jBox.tip('请选择商品分类');
                return;
            }
            $('#one').css('display','none');
            $('#two').css('display','block');
            var re=$('.addTag').children().eq(1).click();
        }

        function bindBtn3(){
            if ($('#ProductName').val() == "") {
                $.jBox.tip('请填写商品标题');
                $('#ProductName').focus();
                return;
            }
            if ($('#bmaEditor').text() == "" || $('#bmaEditor').text() == null) {
                $.jBox.tip('请填写商品描述');
                $('#bmaEditor').focus();
                return;
            }
            $('#two').css('display','none');
            $('#three').css('display','block');
            $('#three').click();
            $('#StoreName').focus();
        }

        function bindBtn5(){
            //SKU校验
            if($("#SKUimg").attr("src").indexOf("8.png")>-1){
                if(!checkStep3()) return false;
            }
            $('#three').css('display','none');
            $('#four').css('display','block');
            $('.addTag').children().eq(3).click();
        }

        function bindBtn7(){
            if ($('#StoreCid').val() == "-1") {
                $.jBox.tip('请选择店铺分类');
                $('.addTag').children().eq(0).click();
                return;
            } if ($('#StoreSTid').val() == "-1") {
                $.jBox.tip('请选择派送模板');
                $('.addTag').children().eq(0).click();
                return;
            }
            if ($('.input').val() == "" || $('.input').val() == null) {
                $.jBox.tip('请选择商品描述');
                $('.addTag').children().eq(1).click();
                return;
            }
            if ($('#bmaEditor').text() == "" || $('#bmaEditor').text() == null) {
                $.jBox.tip('请填写商品描述');
                $('.addTag').children().eq(1).click();
                return;
            }

        }

        function bindImgBtn(){
            $(".chkismain").click(function(){
                $(".chkismain").html("否");
                $(this).html("是");
                $(".ismain").val("0");
                $(".ismain"+$(this).attr("data-index")).val(1);    //当前选中
            });

            $(".chkisbanner").click(function(){
                var index=$(this).attr("data-index");
                if($(this).html()=="是"){
                    $(this).html("否");
                    $(".isbanner"+index).val("0");    //否
                }else{
                    $(this).html("是");
                    $(".isbanner"+index).val("1");    //是
                }
            });

        }

        //删除上传图片的所有值。
        function delpics(index){
            $(".tr_"+parseInt(parseInt(index)-1)).remove();
            $("#shimg"+index).remove();
            $(".uploadPreview").html("");
            $("#del_"+parseInt(parseInt(index)-1)).remove();
            //删除隐藏值。
            //if($('.form_imgs').find('input').length<=1){
            //    $('.form_imgs').html('');
            //}
            if($(".ismain").length<1||$('.copy-td').length)
                if($('.copylogo').val()!=null||$('.copylogo').val()!=""){
                    $(".nopic").css("display","none");
                }else{
                    $(".nopic").css("display","");
                }
        }

        function bindUpload(){
            var uploader = WebUploader.create({
                pick: '.uploadBut',
                auto: true,
                swf: '/components/webuploader/Uploader.swf',
                server: '/storeadmin/tool/upload?operation=uploadproductimage',
                fileVal: 'upload',
                width:50,
                height:50,
                accept: {
                    title: 'Images',
                    extensions: '@ViewData["allowImgType"]',
                    mimeTypes: '*'
                },
                fileSingleSizeLimit: @ViewData["maxImgSize"]
                });

            uploader.on('uploadProgress', function(file, percentage) {
                $(".uploadPreview").html("上传中...");
            });

            uploader.on('uploadSuccess', function(file, response) {
                var data = response._raw;
                if (data == "-1")
                    $(".uploadPreview").html('图片不能为空');
                else if (data == "-2")
                    $(".uploadPreview").html('图片类型不允许');
                else if (data == "-3")
                    $(".uploadPreview").html('图片太大');
                else {
                    $(".uploadPreview").html("<img src=\"@WorkContext.ImageCDN/upload/store/@WorkContext.StoreId/product/show/source/" + data + "\"  />");
                    $("#ShowImg").val(data);
                    addPic(data);//添加图片到列表
                    //上传完之后清空内存
                    uploader.removeFile(file);
                    uploader.reset();
                    //多次添加图片
                    var hidden="<input type='hidden' class='logo' name='ShowImg' id='shimg"+imgIndex+"' value='"+data+"' />";
                    $('.form_imgs').html($('.form_imgs').html()+hidden);

                }
            });
            uploader.on('uploadError', function(file) {$(".uploadPreview").html("上传失败")});
        }

        //文本框提示。

        //弹出增加属性框
        function showlayer() {
            var bh = $(window).height(); //获取屏幕高度
            var bw = $(window).width(); //获取屏幕宽度
            $("#layer1").css({ height: bh, width: bw, display: "block" });
            $("#layer1,.con-right").show();
        }
        //关闭弹窗
        function closeBox() {
            $("#layer1,.con-right").hide();
        }

    </script>
}
@section body{
    <h1 class="rightH1">
        微信小程序 > 商品管理 >
        <ul class="addTag" style="position: absolute;top: 0px;left: 175px;border: 0px;font-size: 14px;height: 26px;color:#f95e01">
            <li style="" id="one">添加商品(1/4)</li>
            <li style="display:none;" id="two">添加商品(2/4商品名称及介绍)</li>
            <li style="display:none;" id="three">添加商品(3/4规格属性(SKU))</li>
            <li style="display:none;" id="four">添加商品(4/4商品头图列表)</li>
        </ul>
        <div class="right">
            <div class="clear"></div>
        </div>
        <div class="clear"></div>
    </h1>


    <div class="clear">
    </div>
    @using (Html.BeginForm("addproduct_new", "product", FormMethod.Post, new { @id = "productform" }))
    {
        @Html.Hidden("Isone", 0, new { @id = "Isone", name = "Isone", value = "0" })
        <input type="hidden" class="BrandId" id="BrandId" name="BrandId" value="99999" />
        <input type="hidden" class="BrandName" id="BrandName" name="BrandName" value="" />
        <input type="hidden" class="ShowType" id="ShowType" name="ShowType" value="0">
        <input type="hidden" class="IsFilter" id="IsFilter" name="IsFilter" value="1">
        @*<input type="hidden" class="DisplayOrder" id="DisplayOrder" name="DisplayOrder" value="0">*@
        <div class="form_imgs" style="display:none"></div>
        <div class="addTable" style="margin-left:20px;">
            <div class="content_tp">
                <div class="content_item">
                    <div class="content_tp_tit">
                        @Html.DropDownListFor(x => x.StoreCid, ViewData["storeClassList"] as List<SelectListItem>)
                    </div>
                    <div class="content_tp_content">
                        <div class="content_img">
                            <a href="/storeadmin/store/storeclasslist">
                                <img src="~/admin_store/images/addproductimg/3.png" style="cursor:pointer;padding-top:10px;" />&nbsp;
                                <div id="span1" style="margin-left:35px;margin-top:-33px;" class="types">店铺分类</div>
                            </a>
                        </div>
                        <div class="content_tp_content_ct">
                            <font size="4"><p>1，店铺管理—店铺分类。</p></font>
                            <font size="4"><p>2，设置分类名称。</p></font>
                            <font size="4"><p>3，设置两级分类，一级添加尺寸为3:1的图片（注：点餐，酒店，票务支持一级分类）。</p></font>
                            <font size="4"><p>4，添加商品前需要设置好店铺所有分类。</p></font>
                        </div>
                        <a href="@Url.Action( "addstoreclass","store")"><input type="button" class="button button-border" value="添加分类" /></a>
                    </div>

                </div>
                <div class="content_item">
                    <div class="content_tp_tit">
                        @Html.DropDownListFor(x => x.StoreSTid, ViewData["storeShipTemplateList"] as List<SelectListItem>)
                    </div>
                    <div class="content_tp_content">
                        <div class="content_img">
                            <a href="/storeadmin/store/StoreShipTemplateList">
                                <img src="~/admin_store/images/addproductimg/4.png" style="cursor:pointer;padding-top:10px;" />&nbsp;
                                <div id="span2" style="margin-left:35px;margin-top:-33px;" class="types">配送模板</div>
                            </a>
                        </div>
                        <div class="content_tp_content_ct" style="cursor:pointer">
                            <font size="4"><p>1，店铺管理—派送模板。</p></font>
                            <font size="4"><p>2，按照不同地区设置邮费标准（全部：针对全国，如有不同计算方式，需要单个省或市进行添加）。</p></font>
                            <font size="4"><p>3，派送模板支持运费核算，不支持满多少包邮。</p></font>
                            <font size="4"><p>4，可设置多套派送模板。</p></font>
                            <font size="4"><p>5，添加商品之后需设置好派送模板。</p></font>
                        </div>
                        <a href="@Url.Action( "addstoreshiptemplate","store")"><input type="button" class="button button-border" value="添加模板" /></a>
                    </div>

                </div>
                <div class="content_item">
                    <div class="content_tp_tit">
                        <div class="selectBt">
                            <input type="button" value="@Model.CategoryName" id="backcatename" onclick="openCategorySelectLayer(this)" />
                            <input type="hidden" class="CateId" id="CateId" name="CateId" value="@Model.CateId" />
                            <input type="hidden" class="CategoryName" id="CategoryName" name="CategoryName" value="@Model.CategoryName" />
                        </div>
                        @Html.ValidationMessageFor(x => x.CateId)
                    </div>
                    <div class="content_tp_content">
                        <div class="content_img">
                            <a href="#">
                                <img src="~/admin_store/images/addproductimg/5.png" style="cursor:pointer;padding-top:10px;" />&nbsp;
                                <div id="span3" style="margin-left:35px;margin-top:-33px;" class="types">商品分类</div>
                            </a>
                        </div>
                        <div class="content_tp_content_ct">
                            <font size="4"> <p>1，选择对应商品分类。</p></font>
                            <font size="4"><p>2，如需设置商品规格属性（SKU），在对应商品分类有可直接使用，如没有则可自己添加设置。</p></font>
                        </div>
                    </div>
                </div>
            </div>
            <div class="foot" style="margin-top:15px;height:60px;">
                <div id="btn1" style="width:30px; height: 60px; float:right; margin-right:100px;">
                    <img src="~/admin_store/images/addproductimg/6.png" style="cursor:pointer" />
                </div>
            </div>
        </div>

        <div class="addTable hide">
            <table width="100%">
                <tr>
                    <td align="right">商品名称：</td>
                    <td>
                        @Html.TextBoxFor(x => x.ProductName, new { @class = "input", placeholder = "必填，字数不能超过100字", size = "80" })
                        @Html.ValidationMessageFor(x => x.ProductName)
                        @*<input class="input" data-val="true" data-val-length="名称长度不能大于100" data-val-length-max="100" data-val-required="名称不能为空" id="ProductName" name="ProductName" size="80" type="text" style="width:566px;" placeholder="必填，字数不能超过100字" value="">
                            <span class="field-validation-valid" data-valmsg-for="ProductName" data-valmsg-replace="true"></span>*@
                    </td>
                </tr>
                <tr>
                    <td align="right">视频地址：</td>
                    <td>
                        @*<input class="input" id="VideoSrc" name="VideoSrc" size="200" type="text" style="width:566px;" placeholder="可不填，建议有自己服务器资源的客户填写" value="">*@
                        @Html.TextBoxFor(x => x.VideoSrc, new { @class = "input", placeholder = "可不填写，建议有自己服务器资源的客户填写", size = "80" })@Html.ValidationMessageFor(x => x.VideoSrc)
                    </td>
                </tr>
                <tr>
                    <td align="right">商品描述：</td>
                    <td>
                        <div style="margin-top: 5px;"></div>
                        <script name="Description" id="bmaEditor" type="text/plain">
                            @Html.Raw(Model.Description)
                        </script>
                        <script type="text/javascript">
                            window.UMEDITOR_CONFIG.imageUrl = "/storeadmin/tool/upload?operation=uploadproducteditorimage";
                            var um = UM.getEditor('bmaEditor');
                            um.setWidth("575px");
                        </script>
                    </td>
                </tr>
                <tr>
                    <td align="right">&nbsp;</td>
                    <td></td>
                </tr>
                <tr>
                    <td align="right"></td>
                    <td>
                        <div id="btn2" style="float:left;">
                            <img src="~/admin_store/images/addproductimg/6.2.png" style="cursor:pointer" />
                        </div>
                        <div id="btn3" style="margin-left:450px;">
                            <img src="~/admin_store/images/addproductimg/6.png" style="cursor:pointer" />
                        </div>
                    </td>
                </tr>
            </table>
        </div>

        <div class="addTable hide">
            <div>
                <div class="price_content">
                    <div class="price_content_tp">
                        <div class="price_content_tp_item">
                            <div class="price_item_ct">
                                <div>成本价：@Html.TextBoxFor(x => x.CostPrice, new { @class = "input", size = "10" })元 @Html.ValidationMessageFor(x => x.CostPrice)<br /></div>
                                <span style="margin-left:45px;color:#c2c2c2;">注：用于计算利润,可以不填</span>
                            </div>
                            <div class="price_item_ct">
                                <div> 市场价：@Html.TextBoxFor(x => x.MarketPrice, new { @class = "input", size = "10" })元 @Html.ValidationMessageFor(x => x.MarketPrice)<br /></div>
                                <span style="margin-left:45px;color:#c2c2c2;">注:市场价为显示横线的价格</span>
                            </div>
                            <div class="price_item_ct" id="pp">
                                <div> 本店价：@Html.TextBoxFor(x => x.ShopPrice, new { @class = "input hideInput", @id = "myprice", size = "10" })元 @Html.ValidationMessageFor(x => x.ShopPrice)<br /></div>
                                <span style="margin-left:45px;color:#c2c2c2;">注:本店价为用户购买支付的价格</span>
                            </div>
                        </div>
                        <div class="price_content_tp_item" id="cc">
                            <div class="price_item_ct">
                                <div>库存：@Html.TextBoxFor(x => x.StockNumber, new { @class = "input hideInput", @id = "mynums", size = "10" })    @Html.ValidationMessageFor(x => x.StockNumber)@Html.CheckBoxFor(x => x.IsRecycle, new { @class = "checkbox" }) <label>循环库存</label><br /></div>
                                <span style="margin-left:35px;color:#c2c2c2;">是否循环库存</span>
                            </div>
                            <div class="price_item_ct">
                                <div>
                                    重量：@Html.TextBoxFor(x => x.Weight, new { @class = "input", size = "10" })克
                                    @Html.ValidationMessageFor(x => x.Weight)
                                </div>
                                <span style="margin-left:35px;color:#c2c2c2;"> 注:用于计算运费 </span>
                            </div>
                            <div class="price_item_ct">
                                <div>
                                    排序：@Html.TextBoxFor(x => x.DisplayOrder, new { @class = "input", size = "10" })
                                    @Html.ValidationMessageFor(x => x.DisplayOrder)<br />
                                </div>
                                <span style="margin-left:35px;color:#c2c2c2;">注:数字越大就排在越前面</span>
                            </div>
                        </div>
                        <div class="price_content_tp_item">
                            <p style="margin-top:10px;margin-left:10px;">商品标签:</p>

                            <div class="sel tab">
                                <div class="chk">
                                    <label style="color:black">@Html.CheckBoxFor(x => x.IsHot, new { @class = "checkbox" }) 热销&nbsp;</label>&nbsp;:勾选则显示在首页热销商品中
                                </div>
                                <div class="chk">
                                    <label style="color:black">@Html.CheckBoxFor(x => x.IsBest, new { @class = "checkbox" }) 精品&nbsp;</label>&nbsp;注:勾选则显示在首页精品推荐中
                                </div>
                                <div class="chk">
                                    <label style="color:black">@Html.CheckBoxFor(x => x.IsNew, new { @class = "checkbox" }) 新品&nbsp;</label>&nbsp;注:勾选则显示在首页新品上市中
                                </div>
                                <div class="chk">
                                    <label style="color:black">
                                        @Html.HiddenFor(x => x.State, new { @class = "checkbox", @name = "State" })
                                        @if (Model.State == 0)
                                        {
                                            <input type="checkbox" class="checkbox" id="chkState" checked="checked" />
                                        }
                                        else
                                        {
                                            <input type="checkbox" class="checkbox" id="chkState" />
                                        }
                                        是否上架
                                    </label>
                                </div>
                            </div>

                        </div>
                    </div>
                    <div id="Dj" class="price_content_mid" style="position:relative;">
                        <div class="price_content_mid_tp">
                            <div class="price_content_mid_tp_sp"><img src="~/admin_store/images/addproductimg/9.png" style="cursor:pointer" />&nbsp;&nbsp;自定义规格属性(SKU)</div>
                            <div id="ZDSKU" style="position:absolute;top: 12px;right: 26px;">
                                <img id="SKUimg" onclick="bechecked(1)" style="z-index:999;cursor:pointer" src="~/admin_store/images/addproductimg/7.png" ;data-id="1" />
                            </div>
                        </div>
                        <div>
                            <br />
                            <table width="100%" id="skuAttributeTable">
                                <tr style="display:none;">
                                    <td width="110px;" align="right">请先选择分类</td>
                                    <td></td>
                                </tr>
                                <tr style="display:none;" id="addSkuBut" class="keepTr">
                                    <td align="right">
                                        &nbsp;
                                    </td>
                                    <td>
                                        <a href="/Product/AddSKU" class="addBt submit">
                                            <img src="/admin_store/images/submit.jpg" />
                                        </a>
                                    </td>
                                </tr>
                                <tr style="display:none;" class="keepTr">
                                    <td align="right">
                                        &nbsp;
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                            </table>
                        </div>
                        <div style="margin-left:20px; margin-top:20px;">
                            <img src="~/admin_store/images/addproductimg/17.png" onclick="addAttr()" style="cursor:pointer" />
                        </div><br />
                        <div id="zhe" style="position:absolute;top:0px;left:0px;height:100%;width:80%;z-index:2;"></div>
                    </div>
                    <div class="price_content_btm" style="display:none;"><table id="skutable" class="skutable" border="1"></table></div><br />
                    <div style="width:85%">
                        <td colspan="3" align="left">
                            <div id="btn4" style="float:left;">
                                <img src="~/admin_store/images/addproductimg/6.2.png" style="cursor:pointer" />
                            </div>
                            <div id="btn5" style="float:right;">
                                <img src="~/admin_store/images/addproductimg/6.png" style="cursor:pointer" />
                            </div>
                        </td>
                    </div>
                </div>
            </div>
            <br /><br />
        </div>

        <div class="addTable hide">
            <br />
            <div class="dataList">
                <table width="100%">
                    <thead>
                        <tr>
                            <th width="20" align="center">
                                <input type="checkbox" id="allSelect" />
                            </th>
                            <th align="left">图片</th>
                            <th width="120" align="center">主图</th>
                            <th width="120" align="center">轮播图</th>
                            <th width="120" align="center">排序</th>
                            <th width="80" align="left">管理操作</th>
                        </tr>
                    </thead>
                    <tbody class="imglist">
                        @*<tr><td colspan="6" class="nopic" style="text-align:center">暂无图片</td></tr>*@
                        @foreach (ProductImageInfo info in imgs.ProductImageList)
                        {
                            <tr>
                                <td align="center">
                                    <input type="checkbox" value="@info.PImgId" />
                                </td>
                                <td class="copy-td">
                                    <input type="hidden" class='logo copylogo' name='ShowImg' value="@info.ShowImg" />
                                    <img height="40" name="Showimg" id="Showimg" class="copy" width="40" src="@WorkContext.ImageCDN/upload/store/@WorkContext.StoreId/product/show/source/@info.ShowImg" />
                                </td>
                                <td align="center">
                                    @if (info.IsMain == 0)
                                    {
                                        <input type="hidden" name="IsMain" id="IsMain" value="@info.IsMain" />
                                        <span style="cursor:pointer" url="@Url.Action("setproductmianimage", new { pImgId = info.PImgId,ismain=0 })" ismain="0" class="mainimgspan">否</span>
                                    }
                                    else
                                    {
                                        <input type="hidden" name="IsMain" id="IsMain" value="@info.IsMain" />
                                        <span style="cursor:pointer" url="@Url.Action("setproductmianimage", new { pImgId = info.PImgId,ismain=1 })" ismain="1" class="mainimgspan">是</span>
                                    }
                                </td>
                                <td align="center">
                                    @if (info.IsBanner == 0)
                                    {
                                        <input type="hidden" name="IsBanner" id="IsBanner" value="@info.IsBanner" />
                                        <span style="cursor:pointer" url="@Url.Action("setproductbannerimage", new { pImgId = info.PImgId, op =0 })" isbanner="0" class="bannerimgspan">否</span>
                                    }
                                    else
                                    {
                                        <input type="hidden" name="IsBanner" id="IsBanner" value="@info.IsBanner" />
                                        <span style="cursor:pointer" url="@Url.Action("setproductbannerimage", new { pImgId = info.PImgId, op =1 })" isbanner="1" class="bannerimgspan">是</span>
                                    }
                                </td>
                                <td align="center">
                                    <input type="hidden" id="order+@info.ImgOrder+'" name="ImgOrder" id="ImgOrder" value="@info.ImgOrder" />
                                    <input type="text" class="txtorder" name="ImgOrder" value="@info.ImgOrder"  style="width:40px;" />
                                </td>
                                <td>
                                    <a href="#" url="@Url.Action("delproductimage", new { pImgId = info.PImgId })" class="ajaxdeleteOperate" }>[删除]</a>
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
            <br />

            <div class="table_bottom bg"></div>
            <div class="fin">
                <table width="100%" style="margin-top:10px;">
                    <tbody>
                        <tr>
                            <td width="66px" align="right">上传图片：</td>
                            <td>
                                <div class="uploadPreview">暂无图片</div>
                                <input type="hidden" name="Pid" id="Pid" value="11" />
                                <div class="upload">
                                    <div class="left">
                                        <div class="uploadProgressBar"></div>
                                        <div class="uploadBut" style="margin-left:20px">选择图片</div>
                                    </div>
                                    <div class="clear"></div>
                                </div>
                                <span style="color:#c2c2c2;">注:建议尺寸800*800</span>
                            </td>
                        </tr>
                        @*<tr style="display:none">
                                <td align="right">排序：</td>
                                <td>
                                    <input type="text" name="DisplayOrder" id="DisplayOrder" value="0" class="input" size="10" /><font color="#c2c2c2">&nbsp;注:数字越大越排在最前面</font>
                                </td>
                            </tr>*@
                        <tr style="display:none;">
                            <td align="right"></td>
                            <td>
                                <img src="~/admin_store/images/addproductimg/16.png" id="addImg" style="margin: 0px; padding: 0px; width:100px;cursor:pointer;" />
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
            &nbsp;&nbsp;&nbsp;&nbsp;<br />
            <div>
                <img src="~/admin_store/images/addproductimg/6.2.png" id="btn6" style="width:100px; height:40px;cursor:pointer;" />
                <img src="~/admin_store/images/addproductimg/14.png" id="btn8" style="margin-right:20px;width:130px; height:40px;float:right;cursor:pointer;" />
                <img src="~/admin_store/images/addproductimg/13.png" id="btn7" style="margin-right:50px;width:100px; height:40px;float:right;cursor:pointer;" />
            </div>
        </div><br /><br /><br />

         <!-- 充值弹出框 -->
        <div id="layer1" onclick="closeBox()" style="display: none;"></div>
        <div class="con-right" id="layer2" style="width:300px; height:200px;">
            <div class="code_title">
                <img onclick="closeBox()" src="http://passport.711688.com.cn/cash/images/delete.png">
                <span><span class="choosen_type_title"></span>增加小程序</span>
            </div>
            <!--显示文本框-->
            <div class="pay_code" style="width:100%; height: 100px; border: 0px;">
                <table class="tab1">
                    <tbody>
                        <tr style="height:40px;">
                            <td>属性分类：</td>
                            <td id="carName" class="attrName">服装</td>
                        </tr>
                        <tr style="height:40px;">
                            <td>属性名称：</td>
                            <td><input type="text" class="AttributName" id="attrValue" name="AttributName" /></td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <div class="cash_msg" style="color: Red; text-align: center;">
            </div>

            <div style="text-align:center"><div class="submitAttr button" style="color:#fff;">确认提交</div></div>
        </div>
    }
}
